home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-24 | 5.2 KB | 186 lines | [TEXT/MPS ] |
- /*
- ** Copyright 1991-1996 Apple Computer. All rights reserved.
- **
- ** You may incorporate this sample code into your applications without
- ** restriction, though the sample code has been provided "AS IS" and the
- ** responsibility for its operation is 100% yours. However, what you are
- ** not permitted to do is to redistribute the source as "DSC Sample Code"
- ** after having made changes. If you're going to re-distribute the source,
- ** we require that you make it clear in the source that the code was
- ** descended from Apple Sample Code, but that you've made changes.
- */
-
- //Description of the PrintX array:
- // 0 used as Enum value 0 corresponding to A4 format (style Dlg)
- // value 1 corresponding to US format (style Dlg)
- // value 2 corresponding to Custom format (style Dlg)
- // 1 reserved
- // 2 used as Integer Horizontal value for Custom format (style Dlg)
- // 3 used as Integer Vertical value for Custom format (style Dlg)
- // 4 used as Enum value 0 corresponding to MilliInches unit (style Dlg)
- // value 1 corresponding to MilliMeters unit (style Dlg)
- // value 2 corresponding to Pixel unit (style Dlg)
- // 5 used as Boolean value 0 corresponding to Portrait Orientation (style Dlg)
- // value 1 corresponding to LandScape Orientation (style Dlg)
- // 6 used as Boolean value 0 corresponding to All pages (job Dlg)
- // value 1 corresponding to pages From … To … (job Dlg)
- // 7 used as Integer signature $5346 "SF"
- // 8 used as Boolean value 0 corresponding to Color (job Dlg)
- // value 1 corresponding to Black & White (job Dlg)
- // 9-18 reserved
-
- #define setPrintErr(err) {*((short *)0x944) = err;}
-
- // the following two macros tell the Icon Utilities to use CopyBits
- // instead of using CopyMask (which doesn't hit the bottleneck)
- #ifndef COMPRESSED_DATA
- /* If we're supporting compressed data printing, we've got our own
- ** StdPix function (see DraftPrPix in MyPDEF_0_DraftMode.c), and
- ** we don't need to do this kludge
- */
- #define setIsPrintingFlag() {*((short *)0x948) = 0;}
- #define clearIsPrintingFlag() {*((short *)0x948) = -1;}
- #else /* COMPRESSED_DATA */
- #define setIsPrintingFlag() {}
- #define clearIsPrintingFlag() {}
- #endif /* COMPRESSED_DATA */
-
- #ifdef isdigit
- /* I REALLY want my own isdigit, which won't use any globals */
- #undef isdigit
- #endif
- #define isdigit(c) ((c>='0')&&(c<='9'))
-
- #define countof(foo) (sizeof(foo)/sizeof(foo[0]))
-
- enum {
- mySignature = 0x5346 // 'SF'
- };
-
- enum { // for TextEdit selections
- startSelectAll = 0,
- endSelectAll = 32767
- };
-
- enum {
- formFeed = 0x0c,
- carriageReturn = 0x0d
- };
-
- enum { // dialog items, both dialogs
- printInvalidItem = -1,
- printOkButton = 1,
- printCancelButton
- };
-
- enum { // dialog items, page setup
- jobTitleItemID = 3,
- jobRangeTitleID,
- jobAllButtonID,
- jobFromButtonID,
- jobFromTextID,
- jobToTitleID,
- jobToTextID,
- jobDivider1,
- jobDivider2,
- jobColorButtonID,
- jobBlackWhiteButtonID
- };
-
- enum { // dialog items, page setup dialog
- stlWindowTitleID = 3,
- stlOrientationTitleID,
- stlPaperTitleID,
- stlPaperA4SizeButtonID,
- stlPaperLetterSizeButtonID,
- stlPaperCustomSizeButtonID,
- stlPortraitIconID,
- stlLandscapeIconID,
- stlDivider1ID,
- stlDivider2ID,
- stlHorizTitleID,
- stlVertTitleID,
- stlUnitsTitleID,
- stlHorizTextID,
- stlVertTextID,
- stlMilliInchButtonID,
- stlMilliMeterButtonID,
- stlPixelsButtonID,
- stlHelpButtonID
- };
-
- enum { // character constants
- enterKey = 3,
- backspaceKey = 8,
- tabKey = 9,
- returnKey = 0x0d,
- escape = 0x1b,
- period = '.'
- };
-
- enum { // resource IDs
- pageSetupDialogID = 0xE001, // -8191
- printDialogID = 0xE000,
- optionsDialogID = 0xDFFF, // -8193
- helpDialogID = 0xDFFE,
- badValueAlertID = -8160
- };
-
- enum { // 'STR ' IDs
- chooserStrings = -8193,
- longerStrings = -8194,
- countChooserStrings = 11,
- baseItemInfoID = -8192,
- defaultFileNameID = -8191,
- defaultPromptID = -8190,
- unknownStrID0 = -4090,
- unknownStrID1 = -4091,
- unknownStrID2 = -4092,
- unknownStrID3 = -4093,
- unknownStrID4 = -4096
- };
-
- enum { // paper sizes
- printOnA4,
- printOnLetter,
- printOnLegal,
- printOnCustom,
- printOnUndefined
- };
-
- enum { // units to measure custom size in
- unitsMilliInch,
- unitsMilliMeter,
- unitsPixels,
- unitsUndefined
- };
-
- typedef struct {
- GrafPtr OtherPort;
- PicHandle thePict;
- CQDProcs cProcs;
- PrIdleUPP idleProc;
- FSSpec fileSpec;
- short fileRef;
- short CurPage;
- short firstPage;
- short lastPage;
- } MyPrintRec, *MyPrintPtr;
-
- // we use this next one all over the place. The idea is to copy the GrafPort
- // except for picSave, rgnSave, polySave, and grafProcs. We're going to
- // replace those with our own values, except for those that we Just Want To
- // Be Nil
- #define mostOfGrafPort (sizeof(GrafPort)-16)
-
- #ifndef VER_SHORT
- #define VER_SHORT 0
- #endif
-
- #ifndef VER_STRING
- #define VER_STRING "Debug"
- #endif
-
- #define IDENT "PictDriver "VER_STRING", Copyright 1996, Apple Computer Inc."
-
-